/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.breeze.util;

import java.util.List;


/**
 *
 * @author huateng
 */
public class PageList {
    private long currentPage=1;
    
    private long pageSize=10;
    
    private long totalNum;
    
    private List resultList;

    public PageList() {
    }
    
    public PageList(int cur){
        if(cur<=0)
            currentPage=1;
        else
            currentPage=cur;
    }
    
    //inclusive
    public long getBeginNum(){
        return (getCurrentPage()-1)*getPageSize();
    }
    
    //exclusive
    public long getEndNum(){
        return getCurrentPage()*getPageSize();
    }

    /**
     * @return the currentPage
     */
    public long getCurrentPage() {
        return currentPage;
    }

    /**
     * @param currentPage the currentPage to set
     */
    public void setCurrentPage(long currentPage) {
        this.currentPage = currentPage;
    }

    /**
     * @return the pageSize
     */
    public long getPageSize() {
        return pageSize;
    }

    /**
     * @param pageSize the pageSize to set
     */
    public void setPageSize(long pageSize) {
        this.pageSize = pageSize;
    }

    /**
     * @return the totalNum
     */
    public long getTotalNum() {
        return totalNum;
    }

    /**
     * @param totalNum the totalNum to set
     */
    public void setTotalNum(long totalNum) {
        this.totalNum = totalNum;
    }

    /**
     * @return the resultList
     */
    public List getResultList() {
        return resultList;
    }

    /**
     * @param resultList the resultList to set
     */
    public void setResultList(List resultList) {
        this.resultList = resultList;
    }
    
    public void nextPage(){
        if(getEndNum()<totalNum)
            currentPage++;
    }
    
    public void prevPage(){
        if(currentPage>1)
            currentPage--;
    }
}
